cmake_minimum_required(VERSION 3.10)

project(DataCodecProject)

set(CMAKE_CXX_STANDARD 11)

# 添加编解码类和测试用例源文件
add_library(DataCodec data_codec.cpp)

# 添加测试用例
add_executable(test_codec test_codec.cpp)
target_link_libraries(test_codec DataCodec pthread)

# 添加串口测试用例
add_executable(serial_test serial_test.cpp)
target_link_libraries(serial_test DataCodec pthread)

# 针对Windows的特定设置
if(WIN32)
    target_link_libraries(serial_test ws2_32)
endif()

# 针对Unix系统的特定设置
if(UNIX)
    target_link_libraries(serial_test pthread)
endif()
